package com.jiazhong.单例模式;

import com.jiazhong.单例模式.Singleton1;

public class SingletonTest1 {
    public static void main(String[] args) {
        Singleton1 s=Singleton1.getInstance();
        System.out.println("其内存地址为"+s);
        Singleton1 s1=Singleton1.getInstance();
        System.out.println("其内存地址为"+s1);
        if (s==s1){
            System.out.println("创建的是同一个实例");
        }else if (s!=s1){
            System.out.println("不是同一个实例");
        }else {
            System.out.println("error");
        }
    }
}
